package com.spboot.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;

import java.time.LocalDate;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;

import java.time.LocalDateTime;

import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 
 * </p>
 *
 * @author guocb
 * @since 2019-12-25
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("smbms_user")
public class User implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 主键ID
	 */
	@TableId(value = "id", type = IdType.AUTO)
	private Long id;

	/**
	 * 用户编码
	 */
	private String userCode; // user_code

	/**
	 * 用户名称
	 */
	private String userName;

	/**
	 * 用户密码
	 */
	private String userPassword;

	/**
	 * 性别（1:女、 2:男）
	 */
	private Integer gender;

	/**
	 * 出生日期
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	private LocalDate birthday;

	/**
	 * 手机
	 */
	private String phone;

	/**
	 * 地址
	 */
	private String address;

	/**
	 * 用户角色（取自角色表-角色id）
	 */
	private Long userRole;

	/**
	 * 创建者（userId）
	 */
	private Long createdBy;

	/**
	 * 创建时间
	 */
	private LocalDateTime creationDate;

	/**
	 * 更新者（userId）
	 */
	private Long modifyBy;

	/**
	 * 更新时间
	 */
	private LocalDateTime modifyDate;

	private String idPicPath;

	/**
	 * 0 未删除 1 已删除
	 */
	@TableLogic //标识逻辑删除字段
	private Integer isDelete;

	// 标识逻辑字段 不是表中列
	@TableField(exist = false)
	public String roleName;// 角色名称

	// 表对应列的常量

	public static final String ID = "id";

	public static final String USERCODE = "userCode";

	public static final String USERNAME = "userName";

	public static final String USERPASSWORD = "userPassword";

	public static final String GENDER = "gender";

	public static final String BIRTHDAY = "birthday";

	public static final String PHONE = "phone";

	public static final String ADDRESS = "address";

	public static final String USERROLE = "userRole";

	public static final String CREATEDBY = "createdBy";

	public static final String CREATIONDATE = "creationDate";

	public static final String MODIFYBY = "modifyBy";

	public static final String MODIFYDATE = "modifyDate";

	public static final String IDPICPATH = "idPicPath";

	public static final String ISDELETE = "isDelete";

}
